<?php

namespace plugin\admin\app\model;

use DateTimeInterface;
use support\Model;


class Base extends Model
{
    /**
     * @var string
     */
    protected $connection = 'plugin.admin.mysql';

    /**
     * 格式化日期
     *
     * @param DateTimeInterface $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    /**
     * 获取器 image
     * @param $value
     * @return mixed|string
     */
    public function getImageAttribute($value)
    {
        if (!empty($value)) {
            $value = env('upload_url') . $value;
        }
        return $value;
    }
}
